import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

class CustomClassicFooter extends StatelessWidget {
  const CustomClassicFooter({super.key});

  @override
  Widget build(BuildContext context) {
    return CustomFooter(
      builder: (BuildContext context, LoadStatus? mode) {
        Widget body;
        if (mode == LoadStatus.idle) {
          body = const Text("上拉加载");
        } else if (mode == LoadStatus.loading) {
          body = const CupertinoActivityIndicator();
        } else if (mode == LoadStatus.failed) {
          body = const Text("加载失败！点击重试！");
        } else if (mode == LoadStatus.canLoading) {
          body = const Text("释放以加载更多");
        } else {
          body = const Text("没有更多数据了");
        }
        return Container(
            alignment: Alignment.center,
            height: 55.0,
            child: Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                mode != LoadStatus.noMore
                    ? const Icon(Icons.refresh)
                    : Container(),
                body
              ],
            ));
      },
    );
  }
}
